import Vue from 'vue'
import Config from '@/utils/config'
import store from '@/store'


const globalFilter = {
	i(value) { // 过滤图片
	    if (!value) {
	    	return '';
	    }
	    if (value.startsWith('http')) {
	    	return value;
	    }
		return (Config.getHostName() + Config.imgUrl + value);
	},
	p(value) {
		var reg = /(\d{3})\d{4}(\d{4})/;
		var tel = value.replace(reg, "$1****$2")
		return tel
	}
}

// 全局过滤器
Object.keys(globalFilter).forEach(k => Vue.filter(k, globalFilter[k]))

export default globalFilter
